package org.weso.acota.appserv;

import java.util.Date;
import java.util.List;

import org.apache.log4j.Logger;
import org.weso.acota.dao.feedback.FeedbackDAO;
import org.weso.acota.factory.FeedbackFactory;
import org.weso.acota.to.feedback.FeedbackResource;
import org.weso.acota.to.feedback.FeedbackTag;
import org.weso.acota.utils.ApplicationContextLocator;

public class FeedbackAppServ {
	protected static Logger logger = Logger.getLogger(FeedbackAppServ.class);

	private FeedbackDAO dao;

	public FeedbackAppServ() {
		this.dao = (FeedbackDAO) ApplicationContextLocator
				.getApplicationContext().getBean(
						FeedbackDAO.class.getSimpleName());
	}

	public FeedbackAppServ(FeedbackFactory factory) {
		this.dao = factory.getFeedbackDAO();
	}

	public String saveSuggestions(String user, String activity, Date taggingDate,
			String resourceUri, String resourceLabel, String resourceDescription,
			List<FeedbackTag> tags) {
		String docUri= this.dao.saveSuggestions(user, activity, taggingDate,
				resourceUri, resourceLabel, resourceDescription,
				tags);
		return docUri;
	}
	
	public List<FeedbackTag> getUserTags(String username){
		return this.dao.getUserTags(username);
	}
	
	public List<FeedbackTag> getDocumentTags(String documentUri){
		return this.dao.getDocumentTags(documentUri);
	}
	
	public List<FeedbackResource> getTaggedDocuments(String label){
		return this.dao.getTaggedDocuments(label);
	}
}
